<template>
	<el-dialog title="投票人员对话框" v-model="visible" :width="500" destroy-on-close @closed="$emit('closed')">
		{{ getUserName() }}
		<template #footer>
			<el-button @click="visible=false">取 消</el-button>
		</template>
	</el-dialog>
</template>

<script>
export default {
	components: {},
	emits: ['success', 'closed'],
	data() {
		return {
			apiObj: this.$API.file.attach.uploadFile,
			visible: false,
			isSaveing: false,
			//表单数据
			form: {},
			userList: [],
		}
	},
	mounted() {
	},
	methods: {
		//显示
		open() {
			this.visible = true;
			return this
		},
		getUserName() {
			let arr = [];
			this.userList.forEach(item => {
				arr.push(item.userName);
			})
			return arr.join(",")
		},
		async voteDetailsForUser() {
			var res = await this.$API.info.vote.voteDetailsForUser.get(this.form);
			if (res.code == 200) {
				this.userList = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		setData(data) {
			this.form.voteId = data.voteId
			this.form.itemId = data.itemId
			this.voteDetailsForUser();
		},
	}
}
</script>

<style>
</style>
